<template>
  <div
    class="btn"
    @click="handerClick"
    :class="{ primary: type == 'primary', waring: type == 'waring' }"
  >
    <!-- 匿名插槽，后期在使用这个组件中，在组件的标签之间的内容都会添加到这个结构中 -->
    <slot></slot>
  </div>
</template>

<script>
export default {
  props: ["type"],
  methods: {
    handerClick(e) {
      this.$emit("click", e);
    },
  },
};
</script>

<style lang="less">
.btn {
  width: 320 * 100vw/360;
  height: 50px;
  background-color: rgb(150, 167, 139);
  border-radius: 25px;
  line-height: 50px;
  text-align: center;
  color: #000;
  font-weight: bold;
  font-size: 20px;
}
.primary {
  background-color: rgb(70, 158, 12);
  color: #fff;
}
.success {
}
.error {
}
.waring {
  background-color: rgb(235, 170, 30);
  color: #fff;
}
</style>